package com.tanhua.management.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.common.mapper.LogsMapper;
import com.tanhua.common.pojo.Log;
import com.tanhua.dubbo.server.vo.PageInfo;
import com.tanhua.management.api.LogApi;
import org.springframework.beans.factory.annotation.Autowired;

import java.lang.reflect.Type;
import java.util.List;

/**
 * Create By Administrator on 2021/7/14.
 */
@Service(version = "1.0.0")
public class LogImpl implements LogApi {

    @Autowired
    private LogsMapper logsMapper;

    @Override
    public PageInfo<Log> queryLogsList(Type type, Integer page, Integer pageSize) {
        PageInfo<Log> pageInfo = new PageInfo<>();

        QueryWrapper<Log> queryWrapper = new QueryWrapper<>();

        List<Log> logs = this.logsMapper.selectList(queryWrapper);


        pageInfo.setPageNum(page);
        pageInfo.setPageSize(pageSize);
        pageInfo.setRecords(logs);
        pageInfo.setTotal(logs.size());

        return pageInfo;
    }
}
